Skip to content

hts221: Add data ready polling in _ensure_data().#130

Merged
nedseb merged 2 commits intomainfrom
fix/hts221-polling-timeout
Mar 14, 2026
Merged

hts221: Add data ready polling in _ensure_data().#130
nedseb merged 2 commits intomainfrom
fix/hts221-polling-timeout

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 14, 2026

Closes #127

Summary

Add polling of STATUS_T_DA bit after trigger_one_shot() with OSError on timeout, consistent with WSEN-HIDS, LIS2MDL, VL53L1X, APDS9960, and ISM330DL.

Test plan

python3 -m pytest tests/ -k "hts221 and mock" -v  # 11 passed

@nedseb nedseb requested a review from Copilot March 14, 2026 22:03
@nedseb nedseb self-assigned this Mar 14, 2026
@nedseb nedseb added the bug Something isn't working label Mar 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the HTS221 driver’s one-shot auto-trigger path to wait for a data-ready indication instead of relying solely on a fixed delay, aligning HTS221 with the broader “poll + timeout” pattern used in other drivers.

Changes:

  • Add bounded polling of HTS221_STATUS_REG after trigger_one_shot() in _ensure_data().
  • Raise OSError on data-ready timeout to avoid silent hangs/infinite waits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/hts221/hts221/device.py Outdated
Comment thread lib/hts221/hts221/device.py
@nedseb nedseb merged commit 949e586 into main Mar 14, 2026
3 checks passed
@nedseb nedseb deleted the fix/hts221-polling-timeout branch March 14, 2026 22:17
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hts221: Add data ready polling in _ensure_data() for consistency.

2 participants